<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="com.cap.bts.framework.usermgnt.constant.EmployeeStatus"%>    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>会员卡配送</title>
<%@include file="../include/include.jsp"%>
<link rel="stylesheet" type="text/css" href="${csspath }/public.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/datepicker.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/style_l.css"/>
<script type="text/javascript" src="${jspath }/jquery-1.4.4.js"></script>
<script type="text/javascript" src="${jspath }/jquery.ui.min.js"></script>
<script type="text/javascript" src="${jspath }/ui.datepicker_zh-CN.js"></script>
<script type="text/javascript" src="${jspath }/jquery.blockUI.js"></script>
<script type="text/javascript" src="${jspath }/public.js"></script>
<script type="text/javascript" src="${jspath }/jquery.selectAll.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.alerts.js"></script>
<script type="text/javascript" src="${jspath}/load_layer.js"></script>
<link rel="stylesheet" type="text/css" href="${csspath}/jquery.alerts.css" />

<link rel="stylesheet" type="text/css"
	href="${webcontext}/css/validationEngine.jquery.css" />
<script src="${jspath}/jquery/validate/jquery.validationEngine.js"
	type="text/javascript"></script>
<script src="${jspath}/jquery/validate/jquery.validationEngine-zh.js"
	type="text/javascript"></script>
	<script type="text/javascript"
	src="${webcontext}/javascript/jquery/jquery.ui.draggable.js"></script>
<link rel="stylesheet" type="text/css"
	href="${bootstrapPath}/css/bootstrap.css" />
<script type="text/javascript" src="${bootstrapPath}/js/bootstrap.js"></script>
<style type="text/css">
html, body {
	overflow: auto;
}
.formError .formErrorContent {
    -moz-border-radius: 6px 6px 6px 6px;
    -moz-box-shadow: 0 0 6px #000000;
    background: none repeat scroll 0 0 #EE0101;
    border: 2px solid #DDDDDD;
    color: #FFFFFF;
    font-family: tahoma;
    font-size: 11px;
    padding: 4px 10px;
    width: 100px;
} 
</style>
<script type="text/javascript">
var myHeight = 0;
$(function(){
	$("#search_form").validationEngine(
			{
             promptPosition:"topLeft",
             success:false,
             validationEventTriggers:"blur",
             scroll : false,
			 failure:function(){} 
	});

	$("#printPage").click(function(){
		$("#buttons").hide();
		$("#allCheckedP").hide();
		var record=document.getElementsByName('checkboxCheck');
		var recordList="";
		for (var i=0;i<record.length;i++ ){
			$("#checkboxDiv"+record[i].value).hide();
		    if(record[i].checked){
		   	 recordList+=record[i].value;
		   	 }else{
		    	 $("#recordDiv"+record[i].value).hide();
		   	 }
		  }
		if (recordList == "") {
				jAlert("请选择记录！","提示信息");
			}else{
				for (var i=0;i<record.length;i++ ){
				    if(!record[i].checked){
				    	$("#recordDiv"+record[i].value).hide();
				   	 }
				  }
				search_form.action="javascript:window.print();"
				document.getElementById("search_form").submit(); 
			}
		$("#buttons").show();
		$("#allCheckedP").show();
		for (var i=0;i<record.length;i++ ){
			$("#checkboxDiv"+record[i].value).show();
			$("#recordDiv"+record[i].value).show();
			}
	});
});
function selectAll(){
	var checkboxs=document.getElementsByName("checkboxCheck");
	 for (var i=0;i<checkboxs.length;i++) {
		 if($("#allChecked").attr("checked")){
			 checkboxs[i].checked = true;
			 }else{
			 checkboxs[i].checked = false;
			 }
		 }
	 }
function cancelSelectAll(){
	var allChecked=document.getElementsByName("allChecked");
	  for (var i=0;i<allChecked.length;i++) {
		 if($("#allChecked").attr("checked")){
			 allChecked[i].checked = false;
			 }
	 } 
}   
function backToSearch(){
	search_form.action="${webcontext}/crmdp/dealer/logistic/backToLogisitcPage";
	document.getElementById("search_form").submit();
}
</script> 
</head>
<body>
		<!-- content -->
			<!-- search_div -->
	<form:form id="search_form" method="post" modelAttribute="dto">
	<div class="search_div">
				<div id="buttons">
				<div class="spliter h_10"></div>
				<button type="button" style="width: 100px;" class="btn" value="返回 " onclick="backToSearch();"><i class="glyphicon glyphicon-share-alt" style="color:#FFFFFF"></i>&nbsp;返回</button>	
				&nbsp;&nbsp;
				<button type="button" style="width: 100px;" class="btn" value="打印预览 " id="printPage"><i class="glyphicon glyphicon-print" style="color:#FFFFFF"></i>&nbsp;打印预览</button>		
				<!-- <input type="button"  id="printPage" value=" 打 印 预 览 "/> -->
				<div class="spliter h_10"></div>
				</div>
			</div>
			<!-- /search_div -->
			<!-- data_div -->
			<div id="dataTable">
			<br></br>
			<p id="allCheckedP">
			<input type="checkbox" name="allChecked" id="allChecked" onclick="selectAll()"/>
			全选</p>
            <core:forEach items="${resultList}" var="logisticResultsDto">
			<div id="checkboxDiv${logisticResultsDto.id}">
            <input type="checkbox" name="checkboxCheck" value="${logisticResultsDto.id}"
            	onclick="cancelSelectAll()"/></div>
			<div id="recordDiv${logisticResultsDto.id}">
			<div class="spliter h_10"></div>
			<table id="table">
					<tr>
                        <td class="align_m" colspan="7">
                        <font size=4>${logisticResultsDto.dealerName}(${logisticResultsDto.dealerNo})
                        </font></td>
                    </tr>
                    <tr>
                        <td class="align_l" colspan="7"><font size=2>
                        	订单编号:&nbsp;&nbsp;${logisticResultsDto.orderNo}</font></td>
                    </tr>
                    <tr>
                        <td class="align_l" colspan="7"><font size=2>
                     		物流信息:${logisticResultsDto.expressCom}&nbsp;&nbsp;
                        &nbsp;&nbsp;${logisticResultsDto.expressNo}</font></td>
                    </tr>
                    <tr>
                    	<th width="10%">商品名称</th>
						<th width="10%">实发数量</th>
						<th width="10%">发货日期</th>
						<th width="10%">预计到货</th>
						<th width="10%">实收数量</th>
						<th width="10%">收货日期</th>
						<th width="10%">状态</th>
                    </tr>
                    	<core:forEach items="${logisticResultsDto.cardList}" var="cardList">
                    <tr>
                        <td class="align_l">${cardList.cardName}</td>
                        <td class="align_r">${cardList.shipAmount}</td>
                        <td class="align_r">${cardList.shipDate}</td>
                        <td class="align_r">${cardList.estimatedArriveDate}</td>
                        <td class="align_r">${cardList.receiveAmount}</td>
                        <td class="align_r">${cardList.receiveDate}</td>
                        <td class="align_m">${cardList.status}</td>
                    </tr>
               			</core:forEach>
			</table>
			</div>
            </core:forEach>
		</div>
			<!-- /data_div -->
		</form:form>
	<!-- /content -->
	</body>
	</html>
		